﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:s="http://schemas.startreksupremacy.com/xaml/core"
                    xmlns:scc="http://schemas.startreksupremacy.com/xaml/presentation"
                    xmlns:cal="http://www.codeplex.com/CompositeWPF"
                    xmlns:local="clr-namespace:Supremacy.Client">
  
  <s:IsNullOrEmptyConverter x:Key="IsNullOrEmptyConverter" />

  <DataTemplate DataType="{x:Type scc:EmpirePlayerStatus}">
        <Grid x:Name="InsigniaHost"
              Background="Transparent"
              ToolTip="{Binding Path=Empire.LongName}"
              Width="28"
              Height="28"
              Margin="3,0,0,0">
            <Border BorderThickness="1.5"
                    BorderBrush="{Binding Path=RelationshipStatus, Converter={StaticResource RelationshipStatusBrushConverter}}"
                    CornerRadius="3"
                    Width="28"
                    Height="28" />
            <Image x:Name="InsigniaSite"
                   HorizontalAlignment="Center"
                   VerticalAlignment="Center"
                   Width="24"
                   Height="24"
                   Stretch="Uniform"
                   IsHitTestVisible="False"
                   Source="{Binding Path=Empire, Converter={StaticResource CivInsigniaConverter}}" />
        </Grid>
    <DataTemplate.Triggers>
      <DataTrigger Binding="{Binding Path=Player.IsHumanPlayer}"
                   Value="True">
        <Setter TargetName="InsigniaHost"
                Property="ToolTip">
          <Setter.Value>
            <TextBlock>
              <TextBlock.Text>
                <MultiBinding StringFormat="{}{0}&#0013;Played by {1}">
                  <Binding Path="Empire.LongName" />
                  <Binding Path="Player.Name" />
                </MultiBinding>
              </TextBlock.Text>
            </TextBlock>
          </Setter.Value>
        </Setter>
      </DataTrigger>
      <DataTrigger Binding="{Binding Path=IsReady}"
                   Value="False">
        <Setter TargetName="InsigniaSite"
                Property="Opacity"
                Value="0.5" />
      </DataTrigger>
    </DataTemplate.Triggers>
  </DataTemplate>

  <Style TargetType="{x:Type scc:GalaxyScreenView}">
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type scc:GalaxyScreenView}">
          <DockPanel LastChildFill="True"
                     Grid.IsSharedSizeScope="True"
                     Background="#66000000">
            <Grid DockPanel.Dock="Top"
                  Margin="6,6,6,4">
              <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
              </Grid.RowDefinitions>
              <Grid.ColumnDefinitions>
                <ColumnDefinition SharedSizeGroup="LeftColumnGroup" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto"
                                  MinWidth="192" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto"
                                  MinWidth="192" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
              </Grid.ColumnDefinitions>
              <Button x:Name="PART_TurnButton"
                      Grid.Column="0"
                      Grid.Row="0"
                      Command="{x:Static scc:ClientCommands.EndTurn}">
                <Button.Content>
                  <TextBlock Text="{Binding Path=(scc:GameScreenViewBase.ClientContext).CurrentGame.TurnNumber, StringFormat={s:StringResource Key=TURN_BUTTON_TEXT, Case=Upper}, RelativeSource={RelativeSource TemplatedParent}}" />
                </Button.Content>
                <Button.Style>
                  <Style TargetType="{x:Type Button}"
                         BasedOn="{StaticResource LCARS_StandardButtonStyle}">
                    <Style.Triggers>
                      <!--<EventTrigger RoutedEvent="Button.Click">
                        <EventTrigger.Actions>
                          <SoundPlayerAction Source="Resources/UI/Federation/Sounds/Turn.wav" />
                        </EventTrigger.Actions>
                      </EventTrigger>-->
                    </Style.Triggers>
                  </Style>
                </Button.Style>
              </Button>
              <Button x:Name="SummaryButton"
                      Grid.Column="0"
                      Grid.Row="1"
                      Style="{StaticResource LCARS_StandardButtonStyle}"
                      Content="{s:StringResource Key=SUMMARY_BUTTON_TEXT, Case=Upper}"
                      Command="{x:Static scc:ClientCommands.ShowEndOfTurnSummary}"
                      Margin="0,4,0,0" />
              <Border x:Name="TopLeftBorder"
                      Grid.Column="1"
                      Grid.Row="0"
                      Background="{StaticResource LCARS_PurpleGradient_TopLeft_BottomRight}"
                      CornerRadius="14,0,0,14"
                      Width="21"
                      Margin="3,0,0,0" />
              <Border x:Name="BottomLeftBorder"
                      Grid.Column="1"
                      Grid.Row="1"
                      Background="{StaticResource LCARS_PurpleGradient_TopLeft_BottomRight}"
                      CornerRadius="14,0,0,14"
                      Width="21"
                      Margin="3,4,0,0" />
              <Border Grid.Column="2"
                      Grid.Row="0"
                      Padding="14,0,14,0"
                      Margin="3,0,0,0"
                      Background="{StaticResource LCARS_BlueGradient_Top_Bottom}">
                <TextBlock FontFamily="{StaticResource LCARS_DefaultFont}"
                           FontSize="18pt"
                           Foreground="Black"
                           Text="SECTOR"
                           HorizontalAlignment="Center" />
              </Border>
              <Border Grid.Column="2"
                      Grid.Row="1"
                      Padding="14,0,14,0"
                      Margin="3,4,0,0"
                      Background="{StaticResource LCARS_OrangeGradient_Top_Bottom}">
                <TextBlock FontFamily="{StaticResource LCARS_DefaultFont}"
                           FontSize="18pt"
                           Foreground="Black"
                           Text="{Binding Path=SelectedSector, Mode=OneWay, Converter={StaticResource SectorNameConverter}, ConverterParameter=UpperCase}"
                           HorizontalAlignment="Center" />
              </Border>
              <Rectangle Grid.Column="3"
                         Grid.Row="0"
                         Width="14"
                         Margin="3,0,0,0"
                         Fill="{StaticResource LCARS_PurpleGradient_Top_Bottom}" />
              <Rectangle Grid.Column="3"
                         Grid.Row="1"
                         Width="14"
                         Margin="3,4,0,0"
                         Fill="{StaticResource LCARS_PurpleGradient_Top_Bottom}" />
              <Border Grid.Column="4"
                      Grid.Row="0"
                      Padding="14,0,14,0"
                      Margin="3,0,0,0"
                      Background="{StaticResource LCARS_BlueGradient_Top_Bottom}">
                <TextBlock FontFamily="{StaticResource LCARS_DefaultFont}"
                           FontSize="18pt"
                           Foreground="Black"
                           Text="AFFILIATION"
                           HorizontalAlignment="Center" />
              </Border>
              <Border Grid.Column="4"
                      Grid.Row="1"
                      Padding="14,0,14,0"
                      Margin="3,4,0,0"
                      Background="{StaticResource LCARS_OrangeGradient_Top_Bottom}">
                <TextBlock x:Name="SectorOwnerText"
                           FontFamily="{StaticResource LCARS_DefaultFont}"
                           FontSize="18pt"
                           Foreground="Black"
                           Text="{Binding Path=SelectedSectorAllegiance, Mode=OneWay, Converter={StaticResource UpperCaseConverter}}"
                           HorizontalAlignment="Center" />
              </Border>
              <Border Grid.Column="5"
                      Grid.Row="0"
                      Padding="7,0,7,0"
                      Margin="3,0,0,0">
                <TextBlock FontFamily="{StaticResource LCARS_DefaultFont}"
                           FontSize="18pt"
                           Foreground="{StaticResource LCARS_HeaderBrush}"
                           Text="SCAN"
                           HorizontalAlignment="Center" />
              </Border>
              <Border Grid.Column="5"
                      Grid.Row="1"
                      Padding="7,0,7,0"
                      Margin="3,4,0,0">
                <TextBlock FontFamily="{StaticResource LCARS_DefaultFont}"
                           FontSize="18pt"
                           Foreground="{Binding Path=HoveredSector, Mode=OneWay, Converter={StaticResource SectorScanStrengthBrushConverter}}"
                           Text="{Binding Path=HoveredSector, Mode=OneWay, Converter={StaticResource SectorScanStrengthConverter}}"
                           HorizontalAlignment="Center" />
              </Border>
              <Rectangle Grid.Column="6"
                         Grid.Row="0"
                         Margin="3,0,0,0"
                         Height="28"
                         Width="28">
                <Rectangle.Fill>
                  <DrawingBrush>
                    <DrawingBrush.Drawing>
                      <GeometryDrawing Brush="{StaticResource LCARS_PurpleGradient_TopLeft_BottomRight}"
                                       Geometry="F1 M 0,0L 18.6667,0C 18.6667,6.22229 18.6667,12.4445 21.7778,15.5555C 24.8889,18.6666 31.1111,18.6666 37.3333,18.6666L 37.3333,37.3333L 0,37.3333L 0,0 Z " />
                    </DrawingBrush.Drawing>
                  </DrawingBrush>
                </Rectangle.Fill>
              </Rectangle>
              <Rectangle Grid.Column="6"
                         Grid.Row="1"
                         Margin="3,4,0,0"
                         Height="28"
                         Width="28">
                <Rectangle.Fill>
                  <DrawingBrush>
                    <DrawingBrush.Drawing>
                      <GeometryDrawing Brush="{StaticResource LCARS_PurpleGradient_TopLeft_BottomRight}"
                                       Geometry="F1 M -1.06581e-013,37.3333L 18.6667,37.3333C 18.6667,31.1111 18.6667,24.8889 21.7778,21.7778C 24.8889,18.6666 31.1111,18.6666 37.3333,18.6666L 37.3333,0L -8.76336e-014,0L -1.06581e-013,37.3333 Z " />
                    </DrawingBrush.Drawing>
                  </DrawingBrush>
                </Rectangle.Fill>
              </Rectangle>
              <Rectangle Grid.Column="7"
                         Grid.Row="0"
                         Margin="3,0,0,0"
                         Height="14"
                         VerticalAlignment="Bottom"
                         Fill="{StaticResource LCARS_BlueGradient_Top_Bottom}" />
              <Rectangle Grid.Column="7"
                         Grid.Row="1"
                         Margin="3,4,0,0"
                         Height="14"
                         VerticalAlignment="Top"
                         Fill="{StaticResource LCARS_OrangeGradient_Top_Bottom}" />
<!--
              <local:ClockControl Grid.Column="7"
                                  Grid.Row="0"
                                  Grid.RowSpan="2"
                                  Margin="7,0,4,0"
                                  ClockMargin="15,3,15,10"
                                  VerticalAlignment="Center" />
-->
              <Image Grid.Column="8"
                     Grid.Row="0"
                     Grid.RowSpan="2"
                     Margin="7,0,4,0"
                     Stretch="Uniform"
                     Height="60"
                     VerticalAlignment="Center"
                     Source="{Binding Path=(scc:GameScreenViewBase.ClientContext).LocalPlayer.Empire, Converter={StaticResource CivInsigniaConverter}, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type scc:GalaxyScreenView}}}" />
              <Border Grid.Column="9"
                      Grid.Row="0"
                      Margin="3,0,0,0"
                      Height="28"
                      VerticalAlignment="Top"
                      Background="{StaticResource LCARS_BlueGradient_Top_Bottom}"
                      Padding="14,0,14,0">
                <TextBlock FontFamily="{StaticResource LCARS_DefaultFont}"
                           FontSize="18pt"
                           HorizontalAlignment="Center"
                           Text="DIPLOMACY" />
              </Border>
              <Border Grid.Column="9"
                      Grid.Row="1"
                      Margin="0,4,0,0"
                      Height="28"
                      VerticalAlignment="Top">
                <ItemsControl ItemsSource="{Binding Path=(scc:GalaxyScreenPresentationModel.EmpirePlayers)}">
                  <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                      <StackPanel Orientation="Horizontal"
                                  IsItemsHost="True" />
                    </ItemsPanelTemplate>
                  </ItemsControl.ItemsPanel>
                </ItemsControl>
<!--
                <StackPanel Orientation="Horizontal">
                  <Rectangle Width="28"
                             Height="28"
                             Fill="{StaticResource LCARS_OrangeGradient_Top_Bottom}" />
                  <Rectangle Width="28"
                             Height="28"
                             Margin="3,0,0,0"
                             Fill="{StaticResource LCARS_OrangeGradient_Top_Bottom}" />
                  <Rectangle Width="28"
                             Height="28"
                             Margin="3,0,0,0"
                             Fill="{StaticResource LCARS_OrangeGradient_Top_Bottom}" />
                  <Rectangle Width="28"
                             Height="28"
                             Margin="3,0,0,0"
                             Fill="{StaticResource LCARS_OrangeGradient_Top_Bottom}" />
                </StackPanel>
-->
              </Border>
              <Border Grid.Column="10"
                      Grid.Row="0"
                      Margin="3,0,0,0"
                      Height="28"
                      Width="21"
                      CornerRadius="0,14,14,0"
                      Background="{StaticResource LCARS_PurpleGradient_TopLeft_BottomRight}" />
              <Border Grid.Column="10"
                      Grid.Row="1"
                      Margin="3,4,0,0"
                      Height="28"
                      Width="21"
                      CornerRadius="0,14,14,0"
                      Background="{StaticResource LCARS_PurpleGradient_TopLeft_BottomRight}" />
            </Grid>
            <Grid DockPanel.Dock="Left"
                  Margin="6,0,4,6">
              <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
              </Grid.RowDefinitions>
              <Grid.ColumnDefinitions>
                <ColumnDefinition Width="240"
                                  SharedSizeGroup="LeftColumnGroup" />
              </Grid.ColumnDefinitions>
              <Expander x:Name="EmpireOverviewRegion"
                        Grid.Row="0"
                        Width="Auto"
                        Header="EMPIRE INFO"
                        Margin="0,0,0,0"
                        IsExpanded="True"
                        Grid.IsSharedSizeScope="False"
                        cal:RegionManager.RegionName="{x:Static scc:GalaxyScreenRegions.EmpireOverview}" />
              <Expander x:Name="EmpireResourcesRegion"
                        Grid.Row="1"
                        Width="Auto"
                        Header="REQUISITION"
                        Margin="0,4,0,0"
                        IsExpanded="True"
                        cal:RegionManager.RegionName="{x:Static scc:GalaxyScreenRegions.EmpireResources}" />
              <GroupBox x:Name="TradeRouteListRegion"
                        Grid.Row="3"
                        Width="Auto"
                        Header="TRADE ROUTES"
                        Margin="0,4,0,0"
                        Visibility="Hidden"
                        cal:RegionManager.RegionName="{x:Static scc:GalaxyScreenRegions.TradeRouteList}" />
              <!-- BEGIN NEW SHITE -->
              <DockPanel x:Name="PART_Fleets"
                         Width="Auto"
                         Margin="0,4,0,0"
                         Grid.Row="3"
                         Visibility="Hidden">
                <Grid x:Name="HeaderSite"
                      Grid.IsSharedSizeScope="False"
                      DockPanel.Dock="Top">
                  <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                  </Grid.ColumnDefinitions>
                  <Grid.RowDefinitions>
                    <RowDefinition Height="28" />
                    <RowDefinition MaxHeight="14" />
                  </Grid.RowDefinitions>
                  <Rectangle x:Name="TopLeftExpanded"
                             Grid.Column="0"
                             Grid.Row="0"
                             Grid.RowSpan="2"
                             Width="21"
                             Height="42">
                    <Rectangle.Fill>
                      <DrawingBrush>
                        <DrawingBrush.Drawing>
                          <GeometryDrawing Brush="{StaticResource LCARS_PurpleGradient_TopLeft_BottomRight}"
                                           Geometry="F1 M -7.62939e-006,56L 3.8147e-006,18.6666C 2.96699e-006,12.4445 2.11928e-006,6.22229 3.11111,3.11121C 6.22222,0 12.4444,0 18.6667,0L 28,0L 28,37.3333L 18.6667,37.3333C 15.5556,37.3333 12.4444,37.3333 10.8889,40.4445C 9.33334,43.5556 9.33334,49.7778 9.33334,56L -7.62939e-006,56 Z " />
                        </DrawingBrush.Drawing>
                      </DrawingBrush>
                    </Rectangle.Fill>
                  </Rectangle>
                  <ContentControl Grid.Column="1"
                                  Grid.Row="0"
                                  Grid.RowSpan="1"
                                  VerticalAlignment="Top"
                                  Margin="7,0,0,0"
                                  FontSize="18pt">
                    <TextBlock FontSize="18pt"
                               Foreground="{StaticResource LCARS_BlueTextBrush}"
                               FontFamily="{StaticResource LCARS_DefaultFont}"
                               Text="TASK FORCES" />
                  </ContentControl>
                  <Rectangle Grid.Column="2"
                             Grid.Row="0"
                             Grid.RowSpan="1"
                             Height="28"
                             VerticalAlignment="Top"
                             Fill="{StaticResource LCARS_BlueGradient_Left_Right}"
                             Margin="7,0,0,0" />
                  <Rectangle Grid.Column="3"
                             Grid.Row="0"
                             Grid.RowSpan="1"
                             Width="14"
                             Height="28"
                             VerticalAlignment="Top"
                             Fill="{StaticResource LCARS_OrangeGradient_Left_Right}"
                             Margin="3,0,0,0" />
                  <Rectangle Grid.Column="4"
                             Grid.Row="0"
                             Grid.RowSpan="1"
                             Width="21"
                             Height="28"
                             VerticalAlignment="Top"
                             Margin="3,0,0,0">
                    <Rectangle.Fill>
                      <DrawingBrush>
                        <DrawingBrush.Drawing>
                          <GeometryDrawing Brush="{StaticResource LCARS_PurpleGradient_TopLeft_BottomRight}"
                                           Geometry="F1 M 9.33333,0C 20.379,0 28,7.62097 28,18.6666C 28,29.7123 20.379,37.3333 9.33333,37.3333L 8.74201e-007,37.3333L 8.74201e-007,0L 9.33333,0 Z " />
                        </DrawingBrush.Drawing>
                      </DrawingBrush>
                    </Rectangle.Fill>
                  </Rectangle>
                </Grid>
                <Grid x:Name="ContentSite"
                      DockPanel.Dock="Bottom">
                  <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="7" />
                    <ColumnDefinition Width="14" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                  </Grid.ColumnDefinitions>
                  <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto"
                                   MaxHeight="28" />
                  </Grid.RowDefinitions>
                  <!--<Path Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" Grid.RowSpan="1" Width="24" Height="12" Stretch="Fill" Fill="{StaticResource LCARS_PurpleGradient_Left_Right}" Margin="0,0,0,0" Data="F1 M 0,16L 1.27157e-006,0L 32,0L 24,0C 18.6667,0 13.3333,0 10.6667,2.66663C 8,5.33337 8,10.6666 8,16L 0,16 Z "/>-->
                  <Rectangle Grid.Column="0"
                             Grid.Row="1"
                             Fill="{StaticResource LCARS_OrangeGradient_Left_Right}"
                             Width="7"
                             Margin="0,3,0,3"
                             Stretch="Fill" />
                  <Rectangle Grid.Column="0"
                             Grid.ColumnSpan="2"
                             Grid.Row="2"
                             Grid.RowSpan="2"
                             Width="21"
                             Height="42">
                    <Rectangle.Fill>
                      <DrawingBrush>
                        <DrawingBrush.Drawing>
                          <GeometryDrawing Brush="{StaticResource LCARS_PurpleGradient_TopLeft_BottomRight}"
                                           Geometry="F1 M 4.76837e-007,0L 1.19209e-005,28C 1.10732e-005,37.3333 1.02255e-005,46.6667 4.66668,51.3333C 9.33334,56 18.6667,56 28,56L 28,18.6666L 18.6667,18.6666C 15.5556,18.6666 12.4445,18.6666 10.8889,15.5555C 9.33334,12.4445 9.33334,6.22229 9.33334,0L 4.76837e-007,0 Z " />
                        </DrawingBrush.Drawing>
                      </DrawingBrush>
                    </Rectangle.Fill>
                  </Rectangle>
                  <!--<Path Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="2" Grid.RowSpan="2" Height="42" Width="24" Stretch="Fill" Fill="{StaticResource LCARS_PurpleGradient_TopLeft_BottomRight}" Data="F1 M 9.4739e-015,0L 1.27157e-006,16C 1.27157e-006,16 1.27157e-006,30.7439 1.27157e-006,36.2667C 1.27157e-006,47.3123 8.95431,56 20,56L 32,56L 32,16L 24,16C 18.6667,16 13.3333,16 10.6667,13.3334C 8,10.6666 8,5.33337 8,0L 9.4739e-015,0 Z "/>-->
                  <Button x:Name="RedeployButton"
                          Grid.Column="2"
                          Grid.Row="3"
                          Margin="3,0,0,0"
                          Height="28"
                          Style="{StaticResource LCARS_SimpleButtonStyle}"
                          CommandParameter="{x:Static scc:GalaxyScreenInputMode.RedeployShips}"
                          Command="{x:Static scc:GalaxyScreenCommands.SetInputMode}"
                          Content="{s:StringResource Key=REDEPLOY_SHIPS, Case=Upper}" />
                  <Rectangle Grid.Column="3"
                             Grid.Row="3"
                             Width="21"
                             Height="28"
                             VerticalAlignment="Top"
                             Margin="3,0,0,0">
                    <Rectangle.Fill>
                      <DrawingBrush>
                        <DrawingBrush.Drawing>
                          <GeometryDrawing Brush="{StaticResource LCARS_PurpleGradient_TopLeft_BottomRight}"
                                           Geometry="F1 M 9.33333,0C 20.379,0 28,7.62097 28,18.6666C 28,29.7123 20.379,37.3333 9.33333,37.3333L 8.74201e-007,37.3333L 8.74201e-007,0L 9.33333,0 Z " />
                        </DrawingBrush.Drawing>
                      </DrawingBrush>
                    </Rectangle.Fill>
                  </Rectangle>
                  <Border Grid.Column="2"
                          Grid.ColumnSpan="2"
                          Grid.Row="0"
                          Grid.RowSpan="3"
                          Padding="0,0,14,14">
                    <DockPanel LastChildFill="True">
                      <Border x:Name="StationPanel"
                              DockPanel.Dock="Top"
                              Margin="0,0,0,14"
                              TextBlock.FontFamily="{StaticResource DefaultFont}"
                              TextBlock.Foreground="{StaticResource DefaultTextBrush}"
                              TextBlock.FontSize="14pt">
                        <DockPanel>
                          <Border DockPanel.Dock="Left"
                                  Width="48"
                                  Height="40"
                                  Margin="0,0,7,0"
                                  BorderBrush="White"
                                  BorderThickness="2"
                                  CornerRadius="4">
                            <Border.Background>
                              <ImageBrush Stretch="UniformToFill"
                                          ImageSource="{Binding Path=SelectedSector.Station.Design, Mode=OneWay, Converter={StaticResource TechObjectImageConverter}}" />
                            </Border.Background>
                            <Image x:Name="ScrapIndicator"
                                   Margin="3"
                                   HorizontalAlignment="Right"
                                   VerticalAlignment="Bottom"
                                   Width="16"
                                   Height="16"
                                   Source="{DynamicResource Scrap_Indicator_Glyph}"
                                   Visibility="Hidden"
                                   IsHitTestVisible="False" />
                          </Border>
                          <TextBlock>
                            <TextBlock Foreground="{StaticResource HeaderTextBrush}"
                                       Text="{Binding Path=SelectedSector.Station.Name, Mode=OneWay, Converter={StaticResource StringResourceConverter}, ConverterParameter=UpperCase}" />
                            <LineBreak />
                            <TextBlock x:Name="StationStatusText"
                                       Text="{Binding Source=OPERATIONAL, Converter={StaticResource StringResourceConverter}}" />
                          </TextBlock>
                        </DockPanel>
                        <Border.ContextMenu>
                          <ContextMenu>
                            <MenuItem x:Name="ScrapStationMenuItem"
                                      Header="{s:StringResource SCRAP}"
                                      Command="{x:Static scc:GalaxyScreenCommands.Scrap}"
                                      IsCheckable="True"
                                      IsChecked="{Binding Path=(MenuItem.CommandParameter).(scc:CheckableCommandParameter.IsChecked), RelativeSource={RelativeSource Self}, Mode=TwoWay, FallbackValue=False}">
                              <MenuItem.CommandParameter>
                                <scc:CheckableCommandParameter InnerParameter="{Binding Path=(scc:GalaxyScreenPresentationModel.SelectedSector).(s:Sector.Station), Mode=OneWay}"
                                                               IsChecked="{Binding Path=(scc:GalaxyScreenPresentationModel.SelectedSector).(s:Sector.Station).(s:TechObject.Scrap), Mode=OneWay}" />
                              </MenuItem.CommandParameter>
                            </MenuItem>
                          </ContextMenu>
                        </Border.ContextMenu>
                      </Border>
                      <ContentControl x:Name="TaskForceListRegion"
                                      cal:RegionManager.RegionName="{x:Static scc:GalaxyScreenRegions.TaskForceList}" />
                    </DockPanel>
                  </Border>
                </Grid>
              </DockPanel>
            </Grid>

            <!-- BEGIN SYSTEM PANEL -->
            <Grid x:Name="BottomPanel"
                  Grid.IsSharedSizeScope="False"
                  Margin="0,6,6,6"
                  DockPanel.Dock="Bottom">
              <Grid.RowDefinitions>
                <RowDefinition Height="42" />
                <RowDefinition Height="*" />
                <RowDefinition Height="21" />
              </Grid.RowDefinitions>
              <Grid.ColumnDefinitions>
                <ColumnDefinition Width="21" />
                <ColumnDefinition Width="0.25*" />
                <ColumnDefinition Width="0.5*" />
                <ColumnDefinition Width="0.25*" />
                <ColumnDefinition Width="21" />
              </Grid.ColumnDefinitions>
              <Rectangle x:Name="TopLeftCorner"
                         Grid.Column="0"
                         Grid.Row="0"
                         Height="42"
                         Width="21">
                <Rectangle.Fill>
                  <DrawingBrush>
                    <DrawingBrush.Drawing>
                      <GeometryDrawing Brush="{StaticResource LCARS_PurpleGradient_TopLeft_BottomRight}"
                                       Geometry="F1 M -7.62939e-006,56L 3.8147e-006,18.6666C 2.96699e-006,12.4445 2.11928e-006,6.22229 3.11111,3.11121C 6.22222,0 12.4444,0 18.6667,0L 28,0L 28,37.3333L 18.6667,37.3333C 15.5556,37.3333 12.4444,37.3333 10.8889,40.4445C 9.33334,43.5556 9.33334,49.7778 9.33334,56L -7.62939e-006,56 Z " />
                    </DrawingBrush.Drawing>
                  </DrawingBrush>
                </Rectangle.Fill>
              </Rectangle>
              <Rectangle x:Name="LeftTopEdge"
                         Grid.Column="1"
                         Height="28"
                         VerticalAlignment="Top"
                         Margin="3,0,0,0"
                         Fill="{StaticResource LCARS_OrangeGradient_Top_Bottom}" />
              <!--<Rectangle x:Name="CenterTopEdge" Grid.Column="2" Grid.Row="0" Height="28" Margin="3,0,3,0" VerticalAlignment="Top" Fill="{StaticResource LCARS_BlueGradient_Top_Bottom}"/>-->
              <Grid Grid.Column="2"
                    Grid.Row="0"
                    Height="28"
                    Margin="3,0,3,0"
                    VerticalAlignment="Top">
                <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="*" />
                  <ColumnDefinition Width="Auto" />
                  <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Rectangle x:Name="LeftCenterTopEdge"
                           Grid.Column="0"
                           Fill="{StaticResource LCARS_BlueGradient_Top_Bottom}" />
                <StackPanel Grid.Column="1"
                            Orientation="Horizontal"
                            Margin="0,0,0,0">
                  <StackPanel x:Name="MapButtonsPanel"
                              Orientation="Horizontal"
                              Margin="0,0,0,0">
                    <Button x:Name="EconomyButton"
                            Style="{StaticResource LCARS_BorderButtonStyle}"
                            Content="ECONOMY"
                            Margin="3,0,0,0"
                            Command="{x:Static scc:GalaxyScreenCommands.SetOverviewMode}"
                            CommandParameter="{x:Static scc:GalaxyScreenOverviewMode.Economic}" />
                    <Button x:Name="MilitaryButton"
                            Style="{StaticResource LCARS_BorderButtonStyle}"
                            Content="MILITARY"
                            Margin="3,0,0,0"
                            Command="{x:Static scc:GalaxyScreenCommands.SetOverviewMode}"
                            CommandParameter="{x:Static scc:GalaxyScreenOverviewMode.Military}" />
                    <Button x:Name="ZoomInButton"
                            Style="{StaticResource LCARS_BorderButtonStyle}"
                            Content="ZOOM IN"
                            Margin="3,0,0,0"
                            Command="{x:Static scc:GalaxyScreenCommands.MapZoomIn}" />
                    <Button x:Name="ZoomOutButton"
                            Style="{StaticResource LCARS_BorderButtonStyle}"
                            Content="ZOOM OUT"
                            Margin="3,0,3,0"
                            Command="{x:Static scc:GalaxyScreenCommands.MapZoomOut}" />
                  </StackPanel>
                  <ToggleButton x:Name="ChatButton"
                                Focusable="False"
                                Style="{StaticResource LCARS_BorderToggleButtonStyle}"
                                Content="CHAT"
                                Margin="0,0,3,0">
                    <ToggleButton.Foreground>
                      <SolidColorBrush x:Name="ChatButtonForeground"
                                       Color="Black" />
                    </ToggleButton.Foreground>
                  </ToggleButton>
                </StackPanel>
                <Rectangle x:Name="RightCenterTopEdge"
                           Grid.Column="2"
                           Margin="0,0,0,0"
                           Fill="{StaticResource LCARS_BlueGradient_Top_Bottom}" />
              </Grid>
              <Grid Grid.Column="3"
                    Grid.Row="0"
                    Height="28"
                    Margin="0,0,3,0"
                    VerticalAlignment="Top">
                <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="*" />
                  <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <Rectangle x:Name="RightTopEdge"
                           Grid.Column="0"
                           Margin="0,0,0,0"
                           Fill="{StaticResource LCARS_OrangeGradient_Top_Bottom}" />
                <TextBlock x:Name="InhabitantsText"
                           Grid.Column="1"
                           Margin="7,0,4,0"
                           Foreground="{StaticResource LCARS_BlueTextBrush}"
                           VerticalAlignment="Center"
                           Text="{Binding Path=SelectedSector.System.Colony.Inhabitants.PluralName, Mode=OneWay, Converter={StaticResource UpperCaseConverter}}"
                           FontFamily="{StaticResource LCARS_DefaultFont}"
                           FontSize="18pt" />
              </Grid>
              <!--<Rectangle x:Name="RightTopEdge"
                         Grid.Column="3"
                         Grid.Row="0"
                         Height="28"
                         Margin="0,0,3,0"
                         VerticalAlignment="Top"
                         Fill="{StaticResource LCARS_OrangeGradient_Top_Bottom}"/>-->
              <Rectangle x:Name="TopRightCorner"
                         Grid.Column="4"
                         Grid.Row="0"
                         Height="42"
                         Width="21">
                <Rectangle.RenderTransform>
                  <ScaleTransform ScaleX="-1"
                                  ScaleY="1"
                                  CenterX="10.5" />
                </Rectangle.RenderTransform>
                <Rectangle.Fill>
                  <DrawingBrush>
                    <DrawingBrush.Drawing>
                      <GeometryDrawing Brush="{StaticResource LCARS_PurpleGradient_TopLeft_BottomRight}"
                                       Geometry="F1 M -7.62939e-006,56L 3.8147e-006,18.6666C 2.96699e-006,12.4445 2.11928e-006,6.22229 3.11111,3.11121C 6.22222,0 12.4444,0 18.6667,0L 28,0L 28,37.3333L 18.6667,37.3333C 15.5556,37.3333 12.4444,37.3333 10.8889,40.4445C 9.33334,43.5556 9.33334,49.7778 9.33334,56L -7.62939e-006,56 Z " />
                    </DrawingBrush.Drawing>
                  </DrawingBrush>
                </Rectangle.Fill>
              </Rectangle>
              <Rectangle x:Name="LeftEdge"
                         Grid.Column="0"
                         Grid.Row="1"
                         Width="7"
                         Margin="0,3,0,3"
                         HorizontalAlignment="Left"
                         Fill="{StaticResource LCARS_OrangeGradient_Left_Right}" />
              <Rectangle x:Name="RightEdge"
                         Grid.Column="4"
                         Grid.Row="1"
                         Width="7"
                         Margin="0,3,0,3"
                         HorizontalAlignment="Right"
                         Fill="{StaticResource LCARS_OrangeGradient_Left_Right}" />
              <Rectangle x:Name="BottomLeftCorner"
                         Grid.Column="0"
                         Grid.Row="2"
                         Height="21"
                         Width="21"
                         VerticalAlignment="Bottom">
                <Rectangle.Fill>
                  <DrawingBrush Stretch="Fill">
                    <DrawingBrush.Drawing>
                      <GeometryDrawing Brush="{StaticResource LCARS_PurpleGradient_TopLeft_BottomRight}"
                                       Geometry="F1 M -2.86102e-006,0L 3.8147e-006,9.33337C 3.8147e-006,15.5555 3.8147e-006,21.7777 3.11111,24.8888C 6.22223,28 12.4444,28 18.6667,28L 28,28L 28,18.6666L 18.6667,18.6666C 15.5556,18.6666 12.4444,18.6666 10.8889,17.1112C 9.33334,15.5555 9.33334,12.4445 9.33334,9.33337L 9.33334,0L -2.86102e-006,0 Z " />
                    </DrawingBrush.Drawing>
                  </DrawingBrush>
                </Rectangle.Fill>
              </Rectangle>
              <Rectangle x:Name="LeftBottomEdge"
                         Grid.Column="1"
                         Grid.Row="2"
                         Height="7"
                         Margin="3,0,0,0"
                         VerticalAlignment="Bottom"
                         Fill="{StaticResource LCARS_OrangeGradient_Top_Bottom}" />
              <Rectangle x:Name="CenterBottomEdge"
                         Grid.Column="2"
                         Grid.Row="2"
                         Height="7"
                         Margin="3,0,3,0"
                         VerticalAlignment="Bottom"
                         Fill="{StaticResource LCARS_BlueGradient_Top_Bottom}" />
              <Rectangle x:Name="RightBottomEdge"
                         Grid.Column="3"
                         Grid.Row="2"
                         Height="7"
                         Margin="0,0,3,0"
                         VerticalAlignment="Bottom"
                         Fill="{StaticResource LCARS_OrangeGradient_Top_Bottom}" />
              <Rectangle x:Name="BottomRightCorner"
                         Grid.Column="4"
                         Grid.Row="2"
                         Height="21"
                         Width="21"
                         VerticalAlignment="Bottom">
                <Rectangle.RenderTransform>
                  <ScaleTransform ScaleX="-1"
                                  CenterX="10.5" />
                </Rectangle.RenderTransform>
                <Rectangle.Fill>
                  <DrawingBrush Stretch="Fill">
                    <DrawingBrush.Drawing>
                      <GeometryDrawing Brush="{StaticResource LCARS_PurpleGradient_TopLeft_BottomRight}"
                                       Geometry="F1 M -2.86102e-006,0L 3.8147e-006,9.33337C 3.8147e-006,15.5555 3.8147e-006,21.7777 3.11111,24.8888C 6.22223,28 12.4444,28 18.6667,28L 28,28L 28,18.6666L 18.6667,18.6666C 15.5556,18.6666 12.4444,18.6666 10.8889,17.1112C 9.33334,15.5555 9.33334,12.4445 9.33334,9.33337L 9.33334,0L -2.86102e-006,0 Z " />
                    </DrawingBrush.Drawing>
                  </DrawingBrush>
                </Rectangle.Fill>
              </Rectangle>
              <ContentControl x:Name="AssignedShipListRegion"
                              Grid.Column="1"
                              Grid.ColumnSpan="3"
                              Grid.Row="1"
                              Margin="7,0,7,0"
                              Height="128"
                              Visibility="Hidden"
                              cal:RegionManager.RegionName="{x:Static scc:GalaxyScreenRegions.AssignedShipList}" />
              <ContentControl x:Name="PlanetsViewRegion"
                              Grid.Column="1"
                              Grid.ColumnSpan="3"
                              Grid.Row="1"
                              Margin="7,0,7,0"
                              Height="128"
                              FontFamily="{StaticResource LCARS_ParagraphFont}"
                              cal:RegionManager.RegionName="{x:Static scc:CommonGameScreenRegions.PlanetsView}" />
              <local:ChatPanel x:Name="PART_ChatPanel"
                               Grid.Column="1"
                               Grid.ColumnSpan="3"
                               Grid.Row="1"
                               Margin="7,0,7,0"
                               Height="128"
                               Visibility="Hidden" />
            </Grid>
            <!-- END SYSTEM PANEL -->

            <Grid DockPanel.Dock="Right">
              <ContentControl x:Name="GalaxyGridRegion"
                              cal:RegionManager.RegionName="{x:Static scc:GalaxyScreenRegions.GalaxyGrid}" />
              <DockPanel x:Name="RedeployPanel"
                         LastChildFill="True"
                         Visibility="Hidden">
                <ContentControl x:Name="ShipInfoPanelBorder"
                                DockPanel.Dock="Left"
                                Margin="7,7,7,0"
                                VerticalAlignment="Top"
                                Style="{StaticResource LCARS_ThinBorderStyle}"
                                DataContext="{Binding Path=SelectedShip}"
                                cal:RegionManager.RegionName="{x:Static scc:GalaxyScreenRegions.ShipStats}" />
                <ContentControl DockPanel.Dock="Right"
                                cal:RegionManager.RegionName="{x:Static scc:GalaxyScreenRegions.AvailableShipList}" />
              </DockPanel>
            </Grid>
          </DockPanel>


          <ControlTemplate.Triggers>
            <DataTrigger Binding="{Binding Path=ClientContext.IsTurnFinished, RelativeSource={RelativeSource TemplatedParent}}"
                         Value="True">
              <Setter TargetName="GalaxyGridRegion"
                      Property="IsEnabled"
                      Value="False" />
              <Setter TargetName="TaskForceListRegion"
                      Property="IsEnabled"
                      Value="False" />
              <Setter TargetName="RedeployButton"
                      Property="IsEnabled"
                      Value="False" />
              <Setter TargetName="MapButtonsPanel"
                      Property="IsEnabled"
                      Value="False" />
            </DataTrigger>
            <DataTrigger Binding="{Binding Path=ClientContext.IsSinglePlayerGame, RelativeSource={RelativeSource TemplatedParent}}"
                         Value="True">
              <Setter TargetName="ChatButton"
                      Property="IsChecked"
                      Value="False" />
              <Setter TargetName="ChatButton"
                      Property="Visibility"
                      Value="Collapsed" />
            </DataTrigger>
            <Trigger SourceName="PART_ChatPanel"
                     Property="IsMessageWaiting"
                     Value="True">
              <Trigger.EnterActions>
                <BeginStoryboard x:Name="BeginChatButtonStoryboard">
                  <Storyboard x:Name="ChatButtonStoryboard">
                    <ColorAnimation Storyboard.TargetName="ChatButtonForeground"
                                    Storyboard.TargetProperty="Color"
                                    From="Black"
                                    To="Red"
                                    AutoReverse="True"
                                    Duration="00:00:00.5"
                                    RepeatBehavior="Forever" />
                  </Storyboard>
                </BeginStoryboard>
              </Trigger.EnterActions>
              <Trigger.ExitActions>
                <StopStoryboard BeginStoryboardName="BeginChatButtonStoryboard" />
              </Trigger.ExitActions>
            </Trigger>
            <Trigger SourceName="ChatButton"
                     Property="IsChecked"
                     Value="True">
              <Setter TargetName="PART_ChatPanel"
                      Property="Visibility"
                      Value="Visible" />
            </Trigger>
            <DataTrigger Binding="{Binding Path=InputMode}"
                         Value="{x:Static scc:GalaxyScreenInputMode.RedeployShips}">
              <Setter TargetName="RedeployButton"
                      Property="Content"
                      Value="{s:StringResource Key=ACCEPT_DEPLOYMENT, Case=Upper}" />
              <Setter TargetName="RedeployButton"
                      Property="CommandParameter"
                      Value="{x:Static scc:GalaxyScreenInputMode.Normal}" />
              <Setter TargetName="GalaxyGridRegion"
                      Property="Visibility"
                      Value="Hidden" />
              <Setter TargetName="RedeployPanel"
                      Property="Visibility"
                      Value="Visible" />
              <Setter TargetName="BottomPanel"
                      Property="Visibility"
                      Value="Collapsed" />
              <!--<Setter TargetName="PART_ChatPanel"
                      Property="Visibility"GSP
                      Value="Hidden" />
              <Setter TargetName="AssignedShipListRegion"
                      Property="Visibility"
                      Value="Visible" />-->
            </DataTrigger>
            <MultiDataTrigger>
              <MultiDataTrigger.Conditions>
                <!--<Condition Binding="{Binding Path=InputMode}"
                           Value="{x:Static scc:GalaxyScreenInputMode.RedeployShips}" />-->
                <Condition Binding="{Binding Path=SelectedTaskForce, Converter={StaticResource IsNullOrEmptyConverter}}"
                           Value="False" />
              </MultiDataTrigger.Conditions>
              <Setter TargetName="PART_ChatPanel"
                      Property="Visibility"
                      Value="Hidden" />
              <Setter TargetName="PlanetsViewRegion"
                      Property="Visibility"
                      Value="Hidden" />
              <Setter TargetName="AssignedShipListRegion"
                      Property="Visibility"
                      Value="Visible" />
            </MultiDataTrigger>
            <Trigger SourceName="PART_ChatPanel"
                     Property="IsVisible"
                     Value="True">
              <Setter TargetName="PlanetsViewRegion"
                      Property="Visibility"
                      Value="Hidden" />
            </Trigger>
            <DataTrigger Binding="{Binding Path=OverviewMode}"
                         Value="{x:Static scc:GalaxyScreenOverviewMode.Economic}">
              <Setter TargetName="TradeRouteListRegion"
                      Property="Visibility"
                      Value="Visible" />
              <Setter TargetName="EconomyButton"
                      Property="Background"
                      Value="{StaticResource LCARS_PinkGradient_Top_Bottom}" />
            </DataTrigger>
            <DataTrigger Binding="{Binding Path=OverviewMode}"
                         Value="{x:Static scc:GalaxyScreenOverviewMode.Military}">
              <Setter TargetName="PART_Fleets"
                      Property="Visibility"
                      Value="Visible" />
              <Setter TargetName="MilitaryButton"
                      Property="Background"
                      Value="{StaticResource LCARS_PinkGradient_Top_Bottom}" />
            </DataTrigger>
            <DataTrigger Binding="{Binding Path=SelectedShip}"
                         Value="{x:Null}">
              <Setter TargetName="ShipInfoPanelBorder"
                      Property="Visibility"
                      Value="Hidden" />
            </DataTrigger>
              <DataTrigger Binding="{Binding Path=SelectedSector.Station}"
                         Value="{x:Null}">
              <Setter TargetName="StationPanel"
                      Property="Visibility"
                      Value="Collapsed" />
            </DataTrigger>
            <DataTrigger Binding="{Binding Path=SelectedSector.Station.Scrap}"
                         Value="True">
              <Setter TargetName="StationStatusText"
                      Property="Text"
                      Value="{s:StringResource Key=SCRAP, Case=Upper}" />
              <Setter TargetName="ScrapIndicator"
                      Property="Visibility"
                      Value="Visible" />
              <Setter TargetName="StationStatusText"
                      Property="Foreground"
                      Value="Crimson" />
            </DataTrigger>
            <DataTrigger Binding="{Binding Path=SelectedSectorInhabitants}"
                         Value="{x:Null}">
              <Setter TargetName="InhabitantsText"
                      Property="Visibility"
                      Value="Collapsed" />
            </DataTrigger>
            <DataTrigger Binding="{Binding Path=SelectedSector.System.Colony}"
                         Value="{x:Null}">
              <Setter TargetName="InhabitantsText"
                      Property="Visibility"
                      Value="Collapsed" />
            </DataTrigger>
          </ControlTemplate.Triggers>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

</ResourceDictionary>
